package com.qianfeng.openplatform.webmaster.controller;

import com.qianfeng.openplatform.webmaster.entry.LayuiDataTableSource;
import com.qianfeng.openplatform.webmaster.entry.OpenApiMaster;
import com.qianfeng.openplatform.webmaster.pojo.ApiSystemparam;
import com.qianfeng.openplatform.webmaster.service.SysParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 江江
 * @Date 2020/7/24 21:52
 */
@RestController
@RequestMapping("/sys/systemparaters")
public class SystemParameterController {
    @Autowired
    private SysParameterService sysParameterService;

    @RequestMapping("/table")
    public LayuiDataTableSource sysParameterTable(@RequestParam(defaultValue = "1") Integer page,
                                                  @RequestParam(defaultValue = "10") Integer limit,
                                                  String name,
                                                  Integer state){
        return sysParameterService.getSysParameterPage(page,limit,name,state);
    }

    @RequestMapping("/add")
    public OpenApiMaster addSysParameter(ApiSystemparam apiSystemparam){
        return  sysParameterService.addSysParameter(apiSystemparam);
    }

    @RequestMapping("/update")
    public OpenApiMaster updateSysParameter(ApiSystemparam apiSystemparam){
        return sysParameterService.updateSysParamter(apiSystemparam);
    }

    @RequestMapping("/del")
    public OpenApiMaster delSysParameter(Integer[] ids){
        return sysParameterService.delSysParameter(ids);
    }
}
